using System;

namespace Deepcode.Flux.Core.Systems.Workflow.Attribs
{
	/// <summary>
	/// Attribute class to implement the [WorkflowMethod] Property
	/// which marks a method as being exposed to the workflow engine.
	/// </summary>
	[AttributeUsage(AttributeTargets.Method)]
	public class WorkflowMethod : System.Attribute
	{
		private string friendlyMethodName;
		private string configurationClassName;
		private bool bHasConfig;

		public string FriendlyMethodName{ get{ return friendlyMethodName; }}
		public string ConfigurationClassName{ get{ return configurationClassName; }}
		public bool HasConfiguration{ get{ return bHasConfig; }}

		/// <summary>
		/// This version of the attribute constructor specifies that a method
		/// should be exposed to the workflow engine with the name specified. It
		/// also specifies that the method invokation is configurable, and the
		/// class exposed by ConfigurationClassName implements the form to 
		/// configure the method.
		/// </summary>
		/// <param name="FriendlyMethodName"></param>
		/// <param name="ConfigurationClassName"></param>
		public WorkflowMethod(string sFriendlyMethodName, string sConfigurationClassName )
		{
			friendlyMethodName = sFriendlyMethodName;
			configurationClassName = sConfigurationClassName;
			bHasConfig = true;
		}
		/// <summary>
		/// This version of the attribute constructor specifies that a method
		/// should be exposed to the workflow engine with the name specified. It
		/// also implies that the workflow method has no runtime configuration
		/// associated with it.
		/// </summary>
		/// <param name="sFriendlyMethodName"></param>
		public WorkflowMethod( string sFriendlyMethodName )
		{
			friendlyMethodName = sFriendlyMethodName;
			configurationClassName = "";
			bHasConfig = false;
		}
	}
}
